﻿using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Graphics;
using Android.Util;
using Android.Widget;
using Environment = Android.OS.Environment;

namespace AndroidApp
{
    public class AppPath
    {
        private static AppPath instance;
        public static AppPath Instance
        {
            get
            {
                return instance ?? (instance = new AppPath());
            }
        }

        private string appDataPath;
        public string AppDataPath
        {
            get
            {
                if (string.IsNullOrEmpty(appDataPath))
                {
                    if (Environment.ExternalStorageState == "mounted")
                    {
                        this.appDataPath = Environment.ExternalStorageDirectory + "/" + "SiAi"; //Android.App.Application.Context.PackageName;
                        if (!System.IO.Directory.Exists(this.appDataPath))
                            System.IO.Directory.CreateDirectory(this.appDataPath);
                    }
                    else
                    {
                        this.appDataPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                    }
                }
                return this.appDataPath;
            }
        }

        private string appUserPath;
        private string AppUserPath
        {
            get
            {
                if (string.IsNullOrEmpty(this.appUserPath))
                {
                    this.appUserPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                }
                return this.appUserPath;
            }
        }

     
    }
}